﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Text;
using System.ComponentModel;
using System.Windows.Forms;

namespace LibExtend
{
    public class DrawText
    {
        private int PulseDirection = 1;

        private bool _MouseOver;
        /// <summary>
        /// Get or Set if the gLabel will Glow when the mouse is over it
        /// </summary>
        [Category("Appearance")] 
        [Description("Get or Set if the gLabel will Glow when the mouse is over it")]
        [RefreshProperties(RefreshProperties.Repaint)]
        [DefaultValue(false)]
        public bool MouseOver
        {
            get{return _MouseOver;}
            set{_MouseOver=value;}
        }

        private Color _MouseOverColor = Color.Crimson;
        /// <summary>
        /// Get or Set what color the gLabel will Glow when the mouse is over it
        /// </summary>
        [Category("Appearance")]
        [Description("Get or Set what color the gLabel will Glow when the mouse is over it")]
        //[DefaultValue(GetType(Color), "Crimson")]
        public Color MouseOverColor
        {
            get { return _MouseOverColor; }
            set { _MouseOverColor = value; }
        }

        private Color _MouseOverForeColor = Color.MediumBlue;
        /// <summary>
        /// Get or Set what Forecolor the gLabel will be when the mouse is over it
        /// </summary>
        [Category("Appearance")]
        [Description("Get or Set what Forecolor the gLabel will be when the mouse is over it")]
        //[DefaultValue(GetType(Color), "MediumBlue")]
        public Color MouseOverForeColor
        {
            get { return _MouseOverForeColor; }
            set { _MouseOverForeColor = value; }
        }

        private bool _FeatherState = true;
        /// <summary>
        /// Get or Set if the text is glowing
        /// </summary>
        public bool FeatherState
        {
            get { return _FeatherState; }
            set { _FeatherState = value; }
        }

        private int _Feather = 100;
        /// <summary>
        /// Get or Set the level of feathering (blurring) of the Outer Glow
        /// </summary>
        public int Feather
        {
            get { return _Feather; }
            set 
            { 
                _Feather = value;
                if (_Feather > 255) _Feather = 255;
                if (_Feather < 0) _Feather = 0;
                PulseDirection = (int)_Feather % 25;
                if (PulseDirection < 0) PulseDirection = 1;
            }
        }

        private Point _ShadowOffset = new Point(5, 5);
        /// <summary>
        /// Get or Set how far to offset the shadow from the text
        /// </summary>
        public Point ShadowOffset
        {
            get { return _ShadowOffset; }
            set { _ShadowOffset = value; }
        }

        private bool _ShadowState;
        /// <summary>
        /// Get or Set if the gLabel displays the shadow text
        /// </summary>
        public bool ShadowState
        {
            get { return _ShadowState; }
            set { _ShadowState = value; }
        }

        private Color _ShadowColor = Color.Gray;
        /// <summary>
        /// Get or Set what color to use for the shadow text
        /// </summary>
        public Color ShadowColor
        {
            get { return _ShadowColor; }
            set { _ShadowColor = value; }
        }

        private bool _GlowMatchChecked = true;
        /// <summary>
        /// Get or Set if the text is glowing
        /// </summary>
        public bool GlowMatchChecked
        {
            get { return _GlowMatchChecked; }
            set { _GlowMatchChecked = value; }
        }

        private bool _GlowState = true;
        /// <summary>
        /// Get or Set if the text is glowing
        /// </summary>
        public bool GlowState
        {
            get { return _GlowState; }
            set { _GlowState = value; }
        }

        private int _Glow = 8;
        /// <summary>
        /// Get or Set how far out the text glows
        /// </summary>
        public int Glow
        {
            get { return _Glow; }
            set { _Glow = value; }
        }

        private Color _GlowColor = Color.CornflowerBlue;
        /// <summary>
        /// Get or Set what color to use for the Glow
        /// </summary>
        public Color GlowColor
        {
            get { return _GlowColor; }
            set { _GlowColor = value; }
        }

        private AnchorStyles _Border = AnchorStyles.None;
        /// <summary>
        /// Get or Set to show or not show the border
        /// </summary>
        public AnchorStyles Border
        {
            get { return _Border; }
            set
            {
                _Border = value;
            }
        }

        private Color _BorderColor = Color.Black;
        /// <summary>
        /// Get or Set what Color to draw the border
        /// </summary>
        public Color BorderColor
        {
            get { return _BorderColor; }
            set { _BorderColor = value; }
        }

        private Single _BorderWidth = 1;
        /// <summary>
        /// Get or Set what Width to draw the border
        /// </summary>
        public Single BorderWidth
        {
            get { return _BorderWidth; }
            set { _BorderWidth = value; }
        }

        private bool _AutoFit;
        /// <summary>
        /// Get or Set if the text is fitted to the DisplayRectangle or uses Font Size 
        /// </summary>
        public bool AutoFit
        {
            get { return _AutoFit; }
            set { _AutoFit = value; }
        }

        private bool _textWordWrap = true;
        /// <summary>
        /// Get or Set if the text wraps inside the DisplayRectangle 
        /// </summary>
        public bool TextWordWrap
        {
            get { return _textWordWrap; }
            set 
            {
                _textWordWrap = value;
               if(!value)
                    sf.FormatFlags = StringFormatFlags.NoWrap;
            }
        }

        private StringFormat sf = new StringFormat();
    }
}
